package sg.edu.nus.iss.vmcs.store;
import java.util.Iterator;
import java.util.*;
public class CSDescendingIterator implements Iterator{
	protected StoreItem items[];
	int position=0;
	
	public CSDescendingIterator(StoreItem[] items)
	{
		this.items=new StoreItem[items.length];
		for(int i=0;i<items.length;i++)
		{
			this.items[i]=items[i];
		}
		Arrays.sort(this.items,new CoinValueComparator()); 
	}
	
	public Object next()
	{
		StoreItem item=items[position];
		position=position+1;
		return item;
	}
	public boolean hasNext()
	{
		if(position>=items.length||items[position]==null)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	
	public void remove()
	{}
	
}
